package example.string;

/**
 * Created by lenovo on 2016/11/4 0004.
 * String 类的 replace 方法来替换字符串中的字符
 */
public class Replace {
    public static void main(String[] args){
        String str = "Hello World";
        System.out.println(str.replace("H","W"));
        System.out.println(str.replaceFirst("He","Wa"));
        System.out.println(str.replaceAll("He","Ha"));
    }
}
